package cn.labbook.bluetooth.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * 生成唯一的序列号
 */
public class SerialNumber {

    /**
     * 生成17位随机数
     * @return
     */
    public static String serial17(){
        int num = UUID.randomUUID().toString().hashCode();
        if (num<0)
            num = -num;
        String format = String.format("%010d", num);
        SimpleDateFormat sdf = new SimpleDateFormat("YYmmdd");
        String date  = sdf.format(new Date());
        String str = "C"+ date + format;
        return str;
    }
}
